<template>
  <div>会员等级 ID={{ id }}</div>
</template>

<script>
import axios from "axios";
export default {
  props: ["id"],
  name: "MemberLevel",
  beforeRouteEnter: (to, from, next) => {
    console.log("进入会员等级页面");
    next();
  },
  beforeRouteLeave: (to, from, next) => {
    console.log("离开会员等级页面");
    next((vm) => {
      vm.getData();
    });
  },
  methods: {
    getData() {
      this.axios({
        method: "get",
        url: "http://172.20.1.11:8888/mydata.json",
      })
        .then((repos) => {
          console.log(repos);
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
};
</script>